package org.hdax.dm.controller;

import com.sun.org.apache.regexp.internal.RE;
import org.hdax.dm.service.UserService;
import org.hdax.dm.vo.CommonResponse;
import org.hdax.dm.vo.entity.user.QueryUserInfoByToken;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping
public class UserController {

    @Autowired
    private UserService userService;

    /**
     * 根据用户token返回用户信息
     * @return
     */
    @PostMapping(path = "/v/queryUserInfoByToken")
    @ResponseBody
    public CommonResponse<QueryUserInfoByToken> queryUserInfoByToken(){
        return userService.queryUserInfoByToken();
    }

    /**
     * 修改用户信息
     */
    @PostMapping(path = "/v/modifyUserInfo")
    @ResponseBody
    public CommonResponse modifyUserInfo(@RequestBody QueryUserInfoByToken queryUserInfoByToken){
        return userService.modifyUserInfo(queryUserInfoByToken);
    }
}
